package com.ruoyi.wxapp;


import com.ruoyi.common.core.domain.AjaxResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.repository.query.Param;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

@RestController
@RequestMapping(value = "/app/public/alipay")
public class AlipayControllr {

    @Autowired
    private AlipayService alipayViewService;
    /**
     * @Function: 去支付
     * @author:   YangXueFeng
     * @Date:     2019/6/11 16:10
     */
    @RequestMapping(value = "/app/alipay/gotopay",method = {RequestMethod.GET,RequestMethod.POST})
    public AjaxResult goToPay(@Param("orderNo") String orderNo,
                              String money
    ){
        return alipayViewService.setGotoPayInfos(orderNo,money);
    }

    /**
     * @Function: 支付宝异步通知回调
     * @author:   YangXueFeng
     * @Date:     2019/6/11 20:02
     */
    @ResponseBody
    @RequestMapping("/app/public/alipay/notify")
    public String notify(HttpServletRequest request, HttpServletResponse response) {
        return alipayViewService.notify(request, response);
    }
}
